<template>
	<view>
		<!-- <live-player
			:src="videoUrl.flvUrl"
			autoplay
			mode="live"
			@statechange="statechange"
			@error="error"
			style="width: 300px; height: 225px;"
			/> -->
		<view>
			<image class="bg" src="/static/imgs/liveBg.png" alt="" /> 
		</view>

		<view class="bg-cneter">
			<image class="title-svg" src="/static/imgs/live.png" alt="" /> 
			<view>
				直播马上开始
			</view>
		</view>
		


	</view>
</template>

<script>
import defaultData from '@/common/js/default.js'
import { Request } from '@/common/js/util.js'

	export default {
		data() {
			return {
				videoUrl: {}
			}
		},
		methods: {
			statechange(e){
				console.log('live-player code:', e.detail.code)
			},
			error(e){
				console.error('live-player error:', e.detail.errMsg)
			},			
			getPlayUrl() {
				Request({
					url: defaultData.baseUrl +'/live/getPlayUrl',
					method:'post',
					header: {
						'content-type': 'application/json' // 设置请求头为application/json
					},					
					data: {roomId: uni.getStorageSync('roomId')}
				}).then(res=>{
					this.videoUrl = res.data

					console.log(111,this.flvUrl);
				}).catch(err=>{
					uni.hideLoading();
					uni.showToast({
						icon:'none',
						title: err.msg,
						duration: 2000
					});
				})				
			}
		},
		onLoad() {
			this.getPlayUrl();
		}
	}
</script>

<style>
.bg{
	width: 100vw;
	height: 50vw;
}

.title-svg{
	width: 30upx;
	height: 30upx;
}
.bg-cneter{
	position: absolute;
	

    background: #525252;
    display: flex;
    color: #cbcbcb;
    font-size: 18px;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50%;
    left: 50%;
    padding: 16px 20px;
    margin-left: -94px;
    margin-top: -31px;	
}

</style>
